importPackage(net.sf.odinms.client);

var status = 0;
var charz = null;

function start() {
	status = -1;
	action(1, 0, 0);
}

function start(cha) {
	charz = cha;
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection, charz) {
	if (mode == -1) {
		cm.dispose();
	} else {
		if (mode == 0) {
			if (charz != null)
				charz.dropMessage(cm.getChar().getName() + " does not want to marry you. Sorry");
			else
				cm.sendOk("Goodbye.");
			cm.dispose();
			return;
		}
		if (mode == 1) status++;
		else status--;
		if (status == 0) {
			if (charz == null)
				cm.sendOk("Hello, do you want to marry someone?");
			else
				cm.sendAcceptDecline(charz.getName() + " wants to marry you\r\nDo you accept this proposal?\r\nIf you do I will warp you here.");
		} else {
			if (charz != null)
				cm.warp(charz.getMapId(), charz.getInitialSpawnpoint());
			cm.dispose();
		}
	}
}



/*importPackage(net.sf.odinms.net.channel);
importPackage(net.sf.odinms.client);
importPackage(net.sf.odinms.server.maps);
importPackage(net.sf.odinms.tools);

var status = 0;
var weddingmap = 680000210;

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
	if (mode == -1) {
        	cm.dispose();
	} else {
        	if (mode == 0) {
			cm.sendOk("Come back if you made up your mind");
        		cm.dispose();
        		return;
        	}
        	if (mode == 1)
        		status++;
        	else
        		status--;
        	if (status == 0) {
			if (!cm.canMarry()) {
				cm.sendYesNo("I see that you want to marry?");
			} else if (cm.getCharQuantity(weddingmap) > 0) {
				cm.sendOk("There is already a wedding going on");
				cm.dispose();
			} else {
				cm.sendOk("You are either not blessed\r\nOr you are already married\r\nOr you don't have 1 #v5251000#\r\nOr you aren't in a party with your spouse\r\n\r\nCome back once you meet the requirements and are willing to marry");
				cm.dispose();
			}
		} else if (status == 1) {
			cm.setWeddingType(1);
			cm.sendSimple("#b#L1#I want invitations to be open (will take 10 minutes to start)#l\r\n#L2#I want a closed wedding (just me and my spouse)#l#k");
		} else if (status == 2) {
			if (selection == 1) {
				cm.worldNotice("A wedding is starting in 10 minutes (Channel " + cm.getChar().getClient().getChannel() + ") use @wedding to get there!");
				cm.warpWedding();
				cm.mapMessage("You will have to wait here until the 10 minutes are over");
				cm.startClock(10);
			} else
				cm.warpWedding();
			cm.dispose();
		}
	}
}*/